package com.cd.dao;

import com.cd.entity.Movie;
import com.cd.mapper.MovieMapper;
import com.cd.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.io.IOException;
import java.util.List;

/**
 * 类名：MovieDao
 * 作者：WF
 * 功能：处理电影相关的数据访问操作
 */
public class CategroiesDao {
	// 1. 查询所有电影
	public List<Movie> findAll() throws IOException {
		try (SqlSession session = MybatisUtil.getSqlSession(true)) {
			MovieMapper movieMapper = session.getMapper(MovieMapper.class);
			return movieMapper.findAll();
		}
	}
}